/* component */
import PlanTimeDialog from '@src/modules/task/view/components/PlanTimeDialog.vue'
import CalendarPlanTimeDialog from '@src/modules/task/view/components/CalendarPlanTimeDialog.vue'
import BatchAllotDialog from '@src/modules/task/taskTypes/allot/components/BatchAllotDialog/BatchAllotDialog.tsx'
import TaskMapInfoWindow from '@src/modules/task/components/TaskAllotModal/TaskMapInfoWindow/TaskMapInfoWindow.tsx'
import BizCallCenterPhone from '@src/component/business/BizCallCenterPhone/BizCallCenterPhone.tsx'

/* enum */
import ComponentNameEnum from '@model/enum/ComponentNameEnum'
/* render */
import AllotMapDialogRender from '@src/modules/task/taskTypes/allot/components/AllotMapDialog/AllotMapDialogRender.tsx'
/* vue */
import { Component } from 'vue-property-decorator'
import { CreateElement } from 'vue'
/* scss */
import '@src/modules/task/taskTypes/allot/components/AllotMapDialog/AllotMapDialog.scss'

import '@src/modules/task/components/TaskAllotModal/TaskMapInfoWindow/TaskMapInfoWindow.scss'
import i18n from '@src/locales'
import { useMapType } from '@src/util/map'

@Component({ 
  name: ComponentNameEnum.AllotMapDialog,
  components: {
    [PlanTimeDialog.name]: PlanTimeDialog,
    [CalendarPlanTimeDialog.name]: CalendarPlanTimeDialog,
    [ComponentNameEnum.BatchAllotDialog]: BatchAllotDialog,
    [ComponentNameEnum.TaskMapInfoWindow]: TaskMapInfoWindow,
    [ComponentNameEnum.BizCallCenterPhone]: BizCallCenterPhone,
  }
})
export default class AllotMapDialog extends AllotMapDialogRender {
  async created(){
    const { currentMapType } = await useMapType();
    this.currentMapType = currentMapType()
  }
  render(h: CreateElement) {
    const attrs = this.getAllotMapDialogAttributes()
    
    return (
      <div class='allot-map' v-show={this.mapShow} v-loading={this.loading}>
        <div class='allot-map-body'>
          <el-button type="primary" class="back-btn" onClick={() => this.$emit('hide')}>{i18n.t('task.list.components.backToList')}</el-button>
          { this.renderAllotMapContainer() }
        </div>
        { this.renderAllotMapComponents() }
      </div>
    )
  }
}

